char c[7],d[7];f(char*a,char*b){return*a-*b;}main(b,i,j){for(b=0,i=100000;!b;){sprintf(c,"%d",++i);qsort(c,6,1,f);for(j=2;j<7;j++){sprintf(d,"%d",i*j);qsort(d,6,1,f);b|=strcmp(c,d);}b=!b;}printf("%d",i);}
